<?php
ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';

//\Biz\model\GoodsStockLog::addLog('C180627-4J5N4M-XpWgK-1',
//	'C180627-4J5N4M-XpWgK-p',
//	1347,
//1,
//0,
//3896,
//1,
//2394601,
//3209
//	);

$fileCsv = '/home/adm_rsync_dir/sqlResult_193907812.csv';
$handle = fopen($fileCsv, 'r');
while (($data = fgetcsv($handle)) !== false) {
	$goods_id = $data[0];
	$cate_id = $data[5];
	$second_cate_id = $data[7];
	$third_cate_id = $data[9];
	$four_cate_id = $data[11];
	$goodsInfo = \Biz\model\GoodsBasicInfo::get('*', ['goods_id' => $goods_id]);
	if (!($goodsInfo['second_category_id'])) {
		echo \Biz\model\GoodsBasicInfo::update([
			'category_id' => $cate_id,
			'second_category_id' => $second_cate_id,
			'third_category_id' => $third_cate_id,
			'four_category_id' => $four_cate_id,
		],['goods_id' => $goods_id])->rowCount();
	}
	\Biz\cache\Goods::delItem($goods_id);
	\Biz\service\search\Goods::updateByGoodsId($goods_id);

}
fclose($handle);

